<?php namespace App\Http\Controllers\Api\Admin;

use App\Http\Controllers\Controller;
use App\Http\Services\AdminManager;
use Illuminate\Http\Request;

class AuthController extends Controller
{
    public function signInAdmin(Request $request){
        $username = $request->get('username');
        $password = $request->get('password');

        $admin = AdminManager::signInByUsername($username,$password,1);

        if(!$admin)
            return response()->json(['level'=>'error','message'=>trans("账号或密码错误！")]);

        return response()->json(['level'=>'success','message'=>trans("登录成功！"),'data'=>$admin]);
    }
}